package com.app.piemoment;

import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RatingBar;
import android.widget.TextView;

import com.app.piemoment.util.Utils;

public class DetailActivity extends BaseActivity {
	private LinearLayout gallery;
	private TextView age_text;
	private TextView constellation_text;
	private TextView location_text;
	private TextView stature_text;
	private TextView hometown_text;
	private TextView profession_text;
	private TextView profession_spinner;
	private RatingBar ratingBar;
	private LinearLayout personal_labels;
	private TextView recent_text;
	private Button btn_edit;

	public DetailActivity() {
		mainViewId = R.layout.detail;
	}

	@Override
	protected void initMainView() {
		initTitle(R.drawable.btn_back_bg, "berry", R.drawable.btn_edit_bg,R.string.btn_edit);
		
		gallery = (LinearLayout)findViewById(R.id.gallery);
		age_text = (TextView)findViewById(R.id.age_text);
		constellation_text = (TextView)findViewById(R.id.constellation_text);
		location_text = (TextView)findViewById(R.id.location_text);
		stature_text = (TextView)findViewById(R.id.stature_text);
		hometown_text = (TextView)findViewById(R.id.hometown_text);
		profession_text = (TextView)findViewById(R.id.profession_text);
		profession_spinner = (TextView)findViewById(R.id.profession_spinner);
		ratingBar = (RatingBar)findViewById(R.id.ratingBar1);
		personal_labels = (LinearLayout)findViewById(R.id.personal_labels);//TODO 动态添加标签
		recent_text = (TextView)findViewById(R.id.recent_text);
		
	}

	@Override
	protected void registerMainViewEvent() {

	}
	
	@Override
	protected void processMainView() {
		if(gallery!=null) {
			gallery.removeAllViews();
			LinearLayout.LayoutParams imageLP = new LinearLayout.LayoutParams(Utils.getScreenWidth(this)/4,Utils.getScreenWidth(this)/4);
			imageLP.setMargins(0, 5, 0, 5);
			for(int i=0;i<4;i++) {
				ImageView image = new ImageView(this);
				image.setImageResource(R.drawable.pm_default);
				gallery.addView(image,imageLP);
			}
		}
	}
	
	@Override
	public void onClick(View v) {
		Intent intent = null;
		switch (v.getId()) {
		case R.id.btn_edit:
			intent = new Intent(this,EditActivity.class);
			startActivity(intent);
			break;

		default:
			break;
		}
	}

}
